﻿#ifndef SAFE_STACK_H
#define SAFE_STACK_H

#include <stack>
#include <mutex>
#include <stdexcept>
#include <cstddef>
#include <limits>

template<typename T>
class SafeStack {
private:
    std::stack<T> dataStack;
    std::stack<T> minStack;
    std::stack<T> maxStack;
    mutable std::mutex mtx;
    size_t capacity;

public:
    explicit SafeStack(size_t cap = 1000);

    void push(const T& value);
    void pop();
    T top() const;
    T min() const;
    T max() const;
    bool empty() const;
    size_t size() const;
    void clear();
};

#endif // SAFE_STACK_H
